﻿using FastCloud.Base.Config;
using FastCloud.Base.Desgin;
using FastCloud.Base.Entity;
using FastUtil.Data;
using System;
using System.Collections.Generic;
using System.Text;

namespace FastCloud.Base.DB
{
    public class DB_OperationLogHistory : BaseML<Frame_OperationLogHistory>
    {
        public override void Insert(Frame_OperationLogHistory Entity)
        {
            if (string.IsNullOrEmpty(Entity.LogGuid))
            {
                Entity.LogGuid = GenerateUtil.GenerateRowGuid();
            }
            Entity.OperateDate = DateTime.Now;
            Entity.OperateOUGuid = OUGuid;
            Entity.OperateOUName = OUName;
            Entity.OperateUserGuid = UserGuid;
            Entity.OperateDisplayName = DisplayName;
            Entity.FromIP = CloudUtil.GetClientIP();
            base.Insert(Entity);
        }

        public override void InsertBatch(List<Frame_OperationLogHistory> EntityList)
        {
            foreach (Frame_OperationLogHistory Entity in EntityList)
            {
                if (string.IsNullOrEmpty(Entity.LogGuid))
                {
                    Entity.LogGuid = GenerateUtil.GenerateRowGuid();
                }
                Entity.OperateDate = DateTime.Now;
                Entity.OperateOUGuid = OUGuid;
                Entity.OperateOUName = OUName;
                Entity.OperateUserGuid = UserGuid;
                Entity.OperateDisplayName = DisplayName;
                Entity.FromIP = CloudUtil.GetClientIP();
            }
            base.InsertBatch(EntityList);
        }
    }
}
